import { getProfileApI } from '@/api/system'
import { routes } from '@/router'

export default {

    namespaced: true,

    state: {
        profile: {},

        menuRouterList: []
    },
    mutations: {
        setProfile(state, newstate) {
            state.profile = newstate
        },
        setMenuRouterList(state, asyncRoute) {
            state.menuRouterList = [...routes, ...asyncRoute]
        }
    },

    getters: {},

    actions: {
        async getProfile(store) {
            const res = await getProfileApI()
                // console.log(res)
            store.commit('setProfile', res.data.permissions)
            return res.data.permissions
        }
    }

}